#!/usr/bin/lua
require("lua-xwrt.addon.string")
require("lua-xwrt.addon.uci")
require("lua-xwrt.html.form")
require("lua-xwrt.xwrt.translator")
require("lua-xwrt.addon.io")
require("lua-xwrt.xwrt.hmenu")
local peer = {	
		"type",
		"context",
		"callingpres",
		"deny",
		"permit",
		"secret",
		"md5secret",
		"dtmfmode",
		"canreinvite",
		"nat",
		"callgroup",
		"pickupgroup",
		"language",
		"disallow",
		"allow",
		"insecure",
		"trustrpid",
		"progressinband",
		"promiscredir",
		"useclientcode",
		"accountcode",
		"setvar",
		"callerid",
		"amaflags",
		"call-limit",
		"allowoverlap",
		"allowsubscribe",
		"allowtransfer",
		"subscribecontext",
		"videosupport",
		"maxcallbitrate",

		"mailbox",
		"username",
--		"template",
		"fromdomain",
		"regexten",
		"fromuser",
		"host",
		"port",
		"qualify",
		"defaultip",
		"rtptimeout",
		"rtpholdtimeout",
		"sendrpid",
		"outboundproxy",

		"rfc2833compensate",
		"t38pt_usertpsource",

		"contactpermit",
		"contactdeny"
}


function template_menu()
	local menu = htmlhmenuClass.new("submenu")
	uci.foreach("asterisk","template", 
		function (t)
			menu:add(t.name, "ipbx.sh?option=extensions&name="..t.name)
		end)
	return menu
end

__ENV = {}

print(util.table2string(template_menu(),"<br>"))